package com.example.tests;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;

import java.util.Random;
import org.testng.annotations.Test;
import com.example.utils.SortedListOf;

public class ContactRemovalTests extends TestBase{
	@Test
	public void deleteSomeContact() {
		//save old contacts
		SortedListOf<ContactData> oldContacts = app.getContactHelper().getContacts();
		
		int rndIndex = new Random().nextInt(oldContacts.size());
				
		//actions
		app.getContactHelper().deleteContact(rndIndex);

		//save new contacts
		SortedListOf<ContactData> newContacts = app.getContactHelper().getContacts();
		
		//assertions
		assertThat(newContacts, equalTo(oldContacts.without(rndIndex)));	
	}
}